class Member < ActiveRecord::Base
	has_many :assignations

        def validate
	    errors.add("Lastname:","You must enter the member Lastname") if not lastname 
    	    errors.add("Name:","You must enter the member Name") if not name
       	    errors.add("Hiring Date:","You must enter a hiring date") if not hiring_date
        end

	def complete_name
		"#{lastname}, #{name}"
	end
        
        def assigned
          a = Assignation.find_by_sql(["SELECT * from assignations a where member_id = ? and active = 1",id])
          if a[0]
            "Assigned"
          else
            "Not Assigned"
          end
          #memberT = Member.find_by_sql(["SELECT m.* FROM members m WHERE m.id = ?",member.id])
          #memberThis.lastname
        end

end
